package com.qf.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.qf.base.BaseServlet;
import com.qf.model.News;

/**
 * Servlet implementation class NewServlet
 */
public class NewServlet extends BaseServlet {
	private static final long serialVersionUID = 1L;
 
	
	protected void board(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	     response.setContentType("text/html;charset=utf-8");
	    List<News> list= newServiceImpl.findall();
//	    System.out.println(list);
	    Gson gson = new Gson();
	    String json = gson.toJson(list);
	    response.getWriter().write(json);
	}

}
